package Demo1;

public class Test {
    public static void main(String[] args) {
        //多态 - 不同对象使用同一方法，实现的效果不同
//        Student student = new Student("zhangsan", 18);
//        Teacher teacher = new Teacher("lisi", 33);
//
//        //不同对象同一方法不同效果
//        People[] people = {student, teacher};
//        for (People p : people) {
//            p.doing();
//        }

//        Teacher teacher = new Teacher("zhangsan",33);
//        teacher.eat();

        //向下转型
//        People people = new Teacher("zhangsan", 20);
//        if (people instanceof Student) {
//            Student student = (Student) people;
//            student.doing();
//        } else {
//            System.out.println("不是老师...");
//        }

    }

}
